<template>
  <div>
    <div class="post-list" v-for="(list, index) in fmtData" :key="index">
    <div class="post-pic">
      <img :src="JSON.parse(list.data.content).titlePicFile.OriginUrlPass" alt="" srcset="">
    </div>
    <div class="post-msg">
      <div class="post-msg-title">
       <router-link 
       :to="{
        name: 'szSource',
        params: {
          id:list.data.id,
          postDatas:list
        }
       }"  
       target="_blank">
        <!-- 帖子链接 -->
        <span>{{JSON.parse(list.data.content).courseTitle}}</span>
       </router-link>
      </div>
      <div class="post-msg-introduce">
        <div class="post-msg-introduce-word">
          <span>{{JSON.parse(list.data.content).courseIntroduce}}</span>
        </div>
      </div>
      <div class="visited-prased">
        <div>{{list.data.createTime.split(" ")[0]}}</div>
        <div>观看量:{{list.countDTO.readTotal}}/点赞量:{{list.countDTO.likeTotal}}</div>
      </div>
    </div>
  </div>
  </div>
  
</template>

<script>
export default {
    name:'postList',
    computed: {
      fmtData(){
        return this.$store.state.soure.SourceList;
      },
    },
    mounted() {
      // console.log("这个页面输出携带数据",this.fmtData);
    },
}
</script>

<style scoped>
.post-list{
  width: 100%;
  height: 200px;
  padding: 20px 10px;
  display: flex;
  overflow: hidden;
  justify-content: flex-start;
  border-top: 1px solid rgb(200, 200, 200);
  border-bottom:  1px solid rgb(200, 200, 200);
}
.post-pic{
  width: 250px;
  height: 160px;

}
.post-pic img{
  width: 100%;
  height: 100%;
  object-fit:cover;
}
.post-msg{
  width: 920px;
  height: 160px;
  padding: 10px;

}
.post-msg-title{
  width: 100%;
  height: 40px;
  line-height: 40px;
}
.post-msg-title a{
  width: 100%;
  height: 100%;  
  display: block;
  overflow: hidden;
  font-size: 20px;
  font-weight: bold;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #333;
  background-color: transparent;
}
.post-msg-title a:hover{
  color: red;
}
.post-msg-introduce{
  width: 100%;
  height: 84px;
}
.post-msg-introduce-word{
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #666;
}
.visited-prased{
  display: flex;
  margin-top: 10px;
  font-weight: bold;
  color: #666;
  justify-content: space-between;
}
</style>